$(function(){
	$(".loginbtn").click(function(){
		var username = $.trim($(".loginuser").val());
		var password = $.trim($(".loginpwd").val());
		if(username == ""){
			$(".loginmsg").html("<span style='color:red;'>请输入用户名!</span>");
			return;
		}
		if(password == ""){
			$(".loginmsg").html("<span style='color:red;'>请输入密码!</span>");
			return;
		}
		var params = {
			username : username,
			password : password,
			extenType : "gateway"
		};
		
		$.ajax({
			type : "post",
			url :basepath+'v1/login',
			datatype : "json",
			contentType : "application/json;charset=utf-8;",
			data : JSON.stringify(params),
			beforeSend:function(){
				$(".loginmsg").html("<span style='color:#000;'>登录中....</span>");
			},
			complete:function(){
				
			},
			success : function(data) {
				var statusCode = data.result;
				var msg = data.msg;
				console.log("statusCode===="+statusCode);
				console.log("msg===="+msg);
				if(statusCode != "1"){
					$(".loginmsg").html("<span style='color:#000;'>"+msg+"</span>");
				}else{
					window.location.href=basepath+"forward/index";
					$(".loginmsg").html("<span style='color:#000;'登录完成,页面跳转中...</span>");
					
				}
			},
			error:function(){
				$(".loginmsg").html("<span style='color:red;'>登录失败,请联系管理员!</span>");
			}
		});
	});
});

